package com.javabasic.algorithm.leetcode;

/**
 * @author mir.xiong
 * @version 1.0
 * @description
 * @see
 * @since Created by work on 2022/6/8 23:43
 */
public class PartitioningIntoMinimumNumberOfDeciBinaryNumbers {

    /**
     * 贪心：为一位达到目标值最快的方法就是 X个1相加
     * @param n
     * @return
     */
    public int minPartitions(String n) {
        int len = n.length();
        int result = 0;
        char charAt;
        for (int i = 0; i < len; i++) {
            charAt = n.charAt(i);
            if (charAt > result) {
                result = charAt;
            }
        }

        return result - '0';
    }
}
